[BALLOON] Do not allow target to be set below two percent of maximum
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 25 May 2006 13:54:43 +0000 (14:54 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 25 May 2006 13:54:43 +0000 (14:54 +0100)
memory size.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c

index b4ef5c1646b270d1d64846e73f03394be657d52f..a1c2ea9d55cadacce61d3507e0b5cb12dcb76a02 100644 (file)
@@ -360,6 +360,12 @@ static void balloon_process(void *unused)
 /* Resets the Xen limit, sets new target, and kicks off processing. */
 static void set_new_target(unsigned long target)
 {
+       unsigned long min_target;
+
+       /* Do not allow target to reduce below 2% of maximum memory size. */
+       min_target = max_pfn / 50;
+       target = max(target, min_target);
+
        /* No need for lock. Not read-modify-write updates. */
        hard_limit   = ~0UL;
        target_pages = target;